package cn.source.system.service.impl;

import cn.source.common.utils.DateUtils;
import cn.source.system.domain.DeyuDevice;
import cn.source.system.mapper.DeyuDeviceMapper;
import cn.source.system.service.IDeyuDeviceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 设备信息Service业务层处理
 * 
 * @author deyucare.com
 * @date 2025-02-20
 */
@Service
public class DeyuDeviceServiceImpl implements IDeyuDeviceService 
{
    @Autowired
    private DeyuDeviceMapper deyuDeviceMapper;

    /**
     * 查询设备信息
     * 
     * @param id 设备信息主键
     * @return 设备信息
     */
    @Override
    public DeyuDevice selectDeyuDeviceById(Long id)
    {
        return deyuDeviceMapper.selectDeyuDeviceById(id);
    }

    /**
     * 查询设备信息列表
     * 
     * @param deyuDevice 设备信息
     * @return 设备信息
     */
    @Override
    public List<DeyuDevice> selectDeyuDeviceList(DeyuDevice deyuDevice)
    {
        return deyuDeviceMapper.selectDeyuDeviceList(deyuDevice);
    }

    /**
     * 新增设备信息
     * 
     * @param deyuDevice 设备信息
     * @return 结果
     */
    @Override
    public int insertDeyuDevice(DeyuDevice deyuDevice)
    {
        deyuDevice.setCreateTime(DateUtils.getNowDate());
        return deyuDeviceMapper.insertDeyuDevice(deyuDevice);
    }

    /**
     * 修改设备信息
     * 
     * @param deyuDevice 设备信息
     * @return 结果
     */
    @Override
    public int updateDeyuDevice(DeyuDevice deyuDevice)
    {
        deyuDevice.setUpdateTime(DateUtils.getNowDate());
        return deyuDeviceMapper.updateDeyuDevice(deyuDevice);
    }

    /**
     * 批量删除设备信息
     * 
     * @param ids 需要删除的设备信息主键
     * @return 结果
     */
    @Override
    public int deleteDeyuDeviceByIds(Long[] ids)
    {
        return deyuDeviceMapper.deleteDeyuDeviceByIds(ids);
    }

    /**
     * 删除设备信息信息
     * 
     * @param id 设备信息主键
     * @return 结果
     */
    @Override
    public int deleteDeyuDeviceById(Long id)
    {
        return deyuDeviceMapper.deleteDeyuDeviceById(id);
    }

    @Override
    public int updateDeyuDeviceFixed(DeyuDevice deyuDevice) {
        deyuDevice.setUpdateTime(DateUtils.getNowDate());
        return deyuDeviceMapper.updateDeyuDeviceFixed(deyuDevice);
    }

    @Override
    public int updateDeyuDeviceUserIdToNull(Long[] ids, Long userId) {
        return deyuDeviceMapper.updateDeyuDeviceUserIdToNull(ids,userId);
    }

    @Override
    public int insertDeyuDeviceFixed(DeyuDevice deyuDevice) {
        deyuDevice.setCreateTime(DateUtils.getNowDate());
        return deyuDeviceMapper.insertDeyuDeviceFixed(deyuDevice);
    }
}
